﻿<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8"/>
    <meta content="IE=9; IE=8; IE=7; IE=EDGE" http-equiv="X-UA-Compatible">
    <meta content="IE=EmulateIE7" http-equiv="X-UA-Compatible"/>
    <title>乐优商城--商品详情页</title>
    <link href="/assets/img/favicon.ico" rel="icon">

    <link href="/css/webbase.css" rel="stylesheet" type="text/css"/>
    <link href="/css/pages-item.css" rel="stylesheet" type="text/css"/>
    <link href="/css/pages-zoom.css" rel="stylesheet" type="text/css"/>
    <link href="/css/widget-cartPanelView.css" rel="stylesheet" type="text/css"/>

    <style type="text/css">
        .goods-intro-list li {
            display: inline-block;
            width: 300px;
        }

        .Ptable {
            margin: 10px 0;
        }

        .Ptable-item {
            padding: 12px 0;
            line-height: 220%;
            color: #999;
            font-size: 12px;
            border-bottom: 1px solid #eee;
        }

        .Ptable-item h3 {
            width: 110px;
            text-align: right;
        }

        .Ptable-item h3, .package-list h3 {
            font-weight: 400;
            font-size: 12px;
            float: left;
        }

        h3 {
            display: block;
            font-size: 1.17em;
            -webkit-margin-before: 1em;
            -webkit-margin-after: 1em;
            -webkit-margin-start: 0px;
            -webkit-margin-end: 0px;
            font-weight: bold;
        }

        .Ptable-item dl {
            margin-left: 110px;
        }

        dl {
            display: block;
            -webkit-margin-before: 1em;
            -webkit-margin-after: 1em;
            -webkit-margin-start: 0px;
            -webkit-margin-end: 0px;
        }

        .Ptable-item dt {
            width: 160px;
            float: left;
            text-align: right;
            padding-right: 5px;
        }

        .Ptable-item dd {
            margin-left: 210px;
        }

        dd {
            display: block;
            -webkit-margin-start: 40px;
        }

        .package-list {
            padding: 12px 0;
            line-height: 220%;
            color: #999;
            font-size: 12px;
            margin-top: -1px;
        }

        .package-list h3 {
            width: 130px;
            text-align: right;
        }

        .package-list p {
            margin-left: 155px;
            padding-right: 50px;
        }
    </style>

</head>

<body>

<!-- 头部栏位 -->
<!--页面顶部，由js动态加载-->
<div id="itemApp">
    <div id="nav-bottom">
        <ly-top/>
    </div>
    <div class="py-container">
        <div id="item">
            <div class="crumb-wrap">
                <ul class="sui-breadcrumb">
                    <li th:each="category:${categories}">
                        <a href="#" th:text="${category.name}"></a>
                    </li>
                    <li>
                        <a href="#" th:text="${brand.name}"></a>
                    </li>
                    <li class="active" th:text="${spu.title}"></li>
                </ul>
            </div>
            <!--product-info-->
            <div class="product-info">
                <div class="fl preview-wrap">
                    <!--放大镜效果-->
                    <div class="zoom">
                        <!--默认第一个预览-->
                        <div class="spec-preview" id="preview">
							<span class="jqzoom">
								<img height="400px" :jqimg="images[0]" :src="images[0]" width="400px"/>
							</span>
                        </div>
                        <!--下方的缩略图-->
                        <div class="spec-scroll">
                            <a class="prev">&lt;</a>
                            <!--左右按钮-->
                            <div class="items">
                                <ul>
                                    <li v-for="(image,index) in images" :key="index">
                                        <img :src="image" :bimg="image" onmousemove="preview(this)"/>
                                    </li>
                                </ul>
                            </div>
                            <a class="next">&gt;</a>
                        </div>
                    </div>
                </div>
                <div class="fr itemInfo-wrap">
                    <div class="sku-name">
                        <h4>{{sku.title}}</h4>
                    </div>
                    <div class="news"><span th:utext="${spu.subTitle}">推荐选择下方[移动优惠购],手机套餐齐搞定,不用换号,每月还有花费返</span></div>
                    <div class="summary">
                        <div class="summary-wrap">
                            <div class="fl title"><i>价　　格</i></div>
                            <div class="fl price">
                                <i>¥</i><em>{{ly.formatPrice(sku.price)}}</em><span>降价通知</span>
                            </div>
                            <div class="fr remark"><i>累计评价</i><em>612188</em></div>
                        </div>
                        <div class="summary-wrap">
                            <div class="fl title">
                                <i>促　　销</i>
                            </div>
                            <div class="fl fix-width">
                                <i class="red-bg">加价购</i>
                                <em class="t-gray">满999.00另加20.00元，或满1999.00另加30.00元，或满2999.00另加40.00元，即可在购物车换
                                    购热销商品</em>
                            </div>
                        </div>
                    </div>
                    <div class="support">
                        <div class="summary-wrap">
                            <div class="fl title">
                                <i>支　　持</i>
                            </div>
                            <div class="fl fix-width">
                                <em class="t-gray">以旧换新，闲置手机回收 4G套餐超值抢 礼品购</em>
                            </div>
                        </div>
                        <div class="summary-wrap">
                            <div class="fl title">
                                <i>配 送 至</i>
                            </div>
                            <div class="fl fix-width">
                                <em class="t-gray">上海 <span>有货</span></em>
                            </div>
                        </div>
                    </div>
                    <div class="clearfix choose">
                        <div class="summary-wrap clearfix" id="specification">
                            <dl v-for="(val,key,index) in specialSpec" :key="index">
                                <dt>
                                    <div class="fl title">
                                        <i>{{paramMap[key]}}</i>
                                    </div>
                                </dt>
                                <dd v-for="(str,j) in val" :key="j">
                                    <a :class="{selected:j==indexes[key]}" href="javascript:;" @click="indexes[key]=j">
                                        {{str}}<span title="点击取消选择">&nbsp;</span>
                                    </a>
                                </dd>
                            </dl>
                        </div>

                        <div class="summary-wrap">
                            <div class="fl title">
                                <div class="control-group">
                                    <div class="controls">
                                        <input autocomplete="off" v-model="num" class="itxt" disabled minnum="1"
                                               type="text"
                                               value="1"/>
                                        <a class="increment plus" href="javascript:void(0)" @click="incr()">+</a>
                                        <a class="increment mins" href="javascript:void(0)" @click="decr()">-</a>
                                    </div>
                                </div>
                            </div>
                            <div class="fl">
                                <ul class="btn-choose unstyled">
                                    <li>
                                        <a href="javascript:void(0);" @click="addCart();"
                                           class="sui-btn  btn-danger addshopcar">加入购物车</a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--product-detail-->
            <div class="clearfix product-detail">
                <div class="fl aside">
                    <ul class="sui-nav nav-tabs tab-wraped">
                        <li class="active">
                            <a data-toggle="tab" href="#index">
                                <span>相关分类</span>
                            </a>
                        </li>
                        <li>
                            <a data-toggle="tab" href="#profile">
                                <span>推荐品牌</span>
                            </a>
                        </li>
                    </ul>
                    <div class="tab-content tab-wraped">
                        <div class="tab-pane active" id="index">
                            <ul class="part-list unstyled">
                                <li>手机</li>
                                <li>手机壳</li>
                                <li>内存卡</li>
                                <li>Iphone配件</li>
                                <li>贴膜</li>
                                <li>手机耳机</li>
                                <li>移动电源</li>
                                <li>平板电脑</li>
                            </ul>
                            <ul class="goods-list unstyled">
                                <li>
                                    <div class="list-wrap">
                                        <div class="p-img">
                                            <img src="/img/_/part01.png"/>
                                        </div>
                                        <div class="attr">
                                            <em>Apple苹果iPhone 6s (A1699)</em>
                                        </div>
                                        <div class="price">
                                            <strong>
                                                <em>¥</em>
                                                <i>6088.00</i>
                                            </strong>
                                        </div>
                                        <div class="operate">
                                            <a class="sui-btn btn-bordered" href="javascript:void(0);">加入购物车</a>
                                        </div>
                                    </div>
                                </li>
                                <li>
                                    <div class="list-wrap">
                                        <div class="p-img">
                                            <img src="/img/_/part02.png"/>
                                        </div>
                                        <div class="attr">
                                            <em>Apple苹果iPhone 6s (A1699)</em>
                                        </div>
                                        <div class="price">
                                            <strong>
                                                <em>¥</em>
                                                <i>6088.00</i>
                                            </strong>
                                        </div>
                                        <div class="operate">
                                            <a class="sui-btn btn-bordered" href="javascript:void(0);">加入购物车</a>
                                        </div>
                                    </div>
                                </li>
                                <li>
                                    <div class="list-wrap">
                                        <div class="p-img">
                                            <img src="/img/_/part03.png"/>
                                        </div>
                                        <div class="attr">
                                            <em>Apple苹果iPhone 6s (A1699)</em>
                                        </div>
                                        <div class="price">
                                            <strong>
                                                <em>¥</em>
                                                <i>6088.00</i>
                                            </strong>
                                        </div>
                                        <div class="operate">
                                            <a class="sui-btn btn-bordered" href="javascript:void(0);">加入购物车</a>
                                        </div>
                                    </div>
                                    <div class="list-wrap">
                                        <div class="p-img">
                                            <img src="/img/_/part02.png"/>
                                        </div>
                                        <div class="attr">
                                            <em>Apple苹果iPhone 6s (A1699)</em>
                                        </div>
                                        <div class="price">
                                            <strong>
                                                <em>¥</em>
                                                <i>6088.00</i>
                                            </strong>
                                        </div>
                                        <div class="operate">
                                            <a class="sui-btn btn-bordered" href="javascript:void(0);">加入购物车</a>
                                        </div>
                                    </div>
                                    <div class="list-wrap">
                                        <div class="p-img">
                                            <img src="/img/_/part03.png"/>
                                        </div>
                                        <div class="attr">
                                            <em>Apple苹果iPhone 6s (A1699)</em>
                                        </div>
                                        <div class="price">
                                            <strong>
                                                <em>¥</em>
                                                <i>6088.00</i>
                                            </strong>
                                        </div>
                                        <div class="operate">
                                            <a class="sui-btn btn-bordered" href="javascript:void(0);">加入购物车</a>
                                        </div>
                                    </div>
                                </li>
                            </ul>
                        </div>
                        <div class="tab-pane" id="profile">
                            <p>推荐品牌</p>
                        </div>
                    </div>
                </div>
                <div class="fr detail">
                    <div class="clearfix fitting">
                        <h4 class="kt">选择搭配</h4>
                        <div class="good-suits">
                            <div class="fl master">
                                <div class="list-wrap">
                                    <div class="p-img">
                                        <img src="/img/_/l-m01.png"/>
                                    </div>
                                    <em>￥5299</em>
                                    <i>+</i>
                                </div>
                            </div>
                            <div class="fl suits">
                                <ul class="suit-list">
                                    <li class="">
                                        <div id="">
                                            <img src="/img/_/dp01.png"/>
                                        </div>
                                        <i>Feless费勒斯VR</i>
                                        <label class="checkbox-pretty" data-toggle="checkbox">
                                            <input type="checkbox"><span>39</span>
                                        </label>
                                    </li>
                                    <li class="">
                                        <div id=""><img src="/img/_/dp02.png"/></div>
                                        <i>Feless费勒斯VR</i>
                                        <label class="checkbox-pretty" data-toggle="checkbox">
                                            <input type="checkbox"><span>50</span>
                                        </label>
                                    </li>
                                    <li class="">
                                        <div id=""><img src="/img/_/dp03.png"/></div>
                                        <i>Feless费勒斯VR</i>
                                        <label class="checkbox-pretty" data-toggle="checkbox">
                                            <input type="checkbox"><span>59</span>
                                        </label>
                                    </li>
                                    <li class="">
                                        <div id=""><img src="/img/_/dp04.png"/></div>
                                        <i>Feless费勒斯VR</i>
                                        <label class="checkbox-pretty" data-toggle="checkbox">
                                            <input type="checkbox"><span>99</span>
                                        </label>
                                    </li>
                                </ul>
                            </div>
                            <div class="fr result">
                                <div class="num">已选购0件商品</div>
                                <div class="price-tit"><strong>套餐价</strong></div>
                                <div class="price">￥5299</div>
                                <button class="sui-btn  btn-danger addshopcar">加入购物车</button>
                            </div>
                        </div>
                    </div>
                    <div class="tab-main intro">
                        <ul class="sui-nav nav-tabs tab-wraped">
                            <li class="active">
                                <a data-toggle="tab" href="#one">
                                    <span>商品介绍</span>
                                </a>
                            </li>
                            <li>
                                <a data-toggle="tab" href="#two">
                                    <span>规格与包装</span>
                                </a>
                            </li>
                            <li>
                                <a data-toggle="tab" href="#three">
                                    <span>售后保障</span>
                                </a>
                            </li>
                            <li>
                                <a data-toggle="tab" href="#four">
                                    <span>商品评价</span>
                                </a>
                            </li>
                            <li>
                                <a data-toggle="tab" href="#five">
                                    <span>手机社区</span>
                                </a>
                            </li>
                        </ul>
                        <div class="clearfix"></div>
                        <div class="tab-content tab-wraped">
                            <div class="tab-pane active" id="one">
                                <!--商品详情-->
                                <div class="intro-detail">
                                    <p th:utext="${spuDetail.description}"></p>
                                </div>
                            </div>
                            <div class="tab-pane" id="two">
                                <div class="Ptable">
                                    <div class="Ptable-item" v-for="group in groups" :key="group.id">
                                        <h3>{{group.name}}</h3>
                                        <dl>
                                            <div v-for="param in group.params" :key="param.id">
                                                <dt>{{param.name}}</dt>
                                                <dd>{{param.v}}</dd>
                                            </div>
                                        </dl>
                                    </div>
                                </div>
                                <div class="package-list">
                                    <h3>包装清单</h3>
                                    <p th:text="${spuDetail.packingList}">手机X1、快速指南X1、华为SuperCharge 充电器X1、三包凭证X1、Type-C
                                        数字耳机X1、Type-C
                                        数据线X1、取卡针X1、TPU保护壳X1、USB Type-C转3.5mm耳机转接线X1（备注：最终以实物为准）</p>
                                </div>
                            </div>
                            <div class="tab-pane" id="three">
                                <p>售后保障</p>
                                <p th:text="${spuDetail.afterService}"></p>
                            </div>
                            <div class="tab-pane" id="four">
                                <p>商品评价</p>
                            </div>
                            <div class="tab-pane" id="five">
                                <p>手机社区</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--like-->
            <div class="clearfix"></div>
            <div class="like">
                <h4 class="kt">猜你喜欢</h4>
                <div class="like-list">
                    <ul class="yui3-g">
                        <li class="yui3-u-1-6">
                            <div class="list-wrap">
                                <div class="p-img">
                                    <img src="/img/_/itemlike01.png"/>
                                </div>
                                <div class="attr">
                                    <em>DELL戴尔Ins 15MR-7528SS 15英寸 银色 笔记本</em>
                                </div>
                                <div class="price">
                                    <strong>
                                        <em>¥</em>
                                        <i>3699.00</i>
                                    </strong>
                                </div>
                                <div class="commit">
                                    <i class="command">已有6人评价</i>
                                </div>
                            </div>
                        </li>
                        <li class="yui3-u-1-6">
                            <div class="list-wrap">
                                <div class="p-img">
                                    <img src="/img/_/itemlike02.png"/>
                                </div>
                                <div class="attr">
                                    <em>Apple苹果iPhone 6s/6s Plus 16G 64G 128G</em>
                                </div>
                                <div class="price">
                                    <strong>
                                        <em>¥</em>
                                        <i>4388.00</i>
                                    </strong>
                                </div>
                                <div class="commit">
                                    <i class="command">已有700人评价</i>
                                </div>
                            </div>
                        </li>
                        <li class="yui3-u-1-6">
                            <div class="list-wrap">
                                <div class="p-img">
                                    <img src="/img/_/itemlike03.png"/>
                                </div>
                                <div class="attr">
                                    <em>DELL戴尔Ins 15MR-7528SS 15英寸 银色 笔记本</em>
                                </div>
                                <div class="price">
                                    <strong>
                                        <em>¥</em>
                                        <i>4088.00</i>
                                    </strong>
                                </div>
                                <div class="commit">
                                    <i class="command">已有700人评价</i>
                                </div>
                            </div>
                        </li>
                        <li class="yui3-u-1-6">
                            <div class="list-wrap">
                                <div class="p-img">
                                    <img src="/img/_/itemlike04.png"/>
                                </div>
                                <div class="attr">
                                    <em>DELL戴尔Ins 15MR-7528SS 15英寸 银色 笔记本</em>
                                </div>
                                <div class="price">
                                    <strong>
                                        <em>¥</em>
                                        <i>4088.00</i>
                                    </strong>
                                </div>
                                <div class="commit">
                                    <i class="command">已有700人评价</i>
                                </div>
                            </div>
                        </li>
                        <li class="yui3-u-1-6">
                            <div class="list-wrap">
                                <div class="p-img">
                                    <img src="/img/_/itemlike05.png"/>
                                </div>
                                <div class="attr">
                                    <em>DELL戴尔Ins 15MR-7528SS 15英寸 银色 笔记本</em>
                                </div>
                                <div class="price">
                                    <strong>
                                        <em>¥</em>
                                        <i>4088.00</i>
                                    </strong>
                                </div>
                                <div class="commit">
                                    <i class="command">已有700人评价</i>
                                </div>
                            </div>
                        </li>
                        <li class="yui3-u-1-6">
                            <div class="list-wrap">
                                <div class="p-img">
                                    <img src="/img/_/itemlike06.png"/>
                                </div>
                                <div class="attr">
                                    <em>DELL戴尔Ins 15MR-7528SS 15英寸 银色 笔记本</em>
                                </div>
                                <div class="price">
                                    <strong>
                                        <em>¥</em>
                                        <i>4088.00</i>
                                    </strong>
                                </div>
                                <div class="commit">
                                    <i class="command">已有700人评价</i>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>

</div>
<script src="/js/vue/vue.js"></script>
<script src="/js/axios.min.js"></script>
<script src="/js/common.js"></script>
<script th:inline="javascript">
    const specialSpec = JSON.parse(/*[[${spuDetail.specialSpec}]]*/"");
    const genericSpec = JSON.parse(/*[[${spuDetail.genericSpec}]]*/"");
    const paramMap = /*[[${paramMap}]]*/{};
    const skus = /*[[${skus}]]*/[];
    const groups = /*[[${groups}]]*/[];
    const indexes = {};
    Object.keys(paramMap).forEach(param => indexes[param] = 0);
</script>

<script>
    var itemVm = new Vue({
        el: "#itemApp",
        data: {
            ly,
            specialSpec,
            paramMap,
            indexes,
            num: 1
        },
        computed: {
            sku() {
                const index = Object.values(this.indexes).join("_");
                return skus.find(sku => sku.indexes == index);
            },
            images() {
                return this.sku.images ? this.sku.images.split(",") : "";
            },
           /* groups() {
                groups.forEach(group => {
                    group.params.forEach(param => {
                        if (param.generic) {
                            param.v = genericSpec[param.id];
                        } else {
                            param.v = JSON.parse(this.sku.ownSpec)[param.id];
                        }
                    })
                });
                return groups;
            }*/
        },
        methods: {
            addCart() {
                ly.verify().then(res => {
                    //登录状态的购物车
                    ly.http.post("/cart", {skuId: this.sku.id, num: this.num}).then(res => {
                        //页面跳转
                        window.location = "http://www.leyou.com/cart.html";
                    });
                }).catch(() => {
                    //未登录状态的购物车
                    //添加商品到localstorage中
                    //先查询
                    let carts = ly.store.get("LY_CART") || [];
                    let cart = carts.find(cart => cart.skuId == this.sku.id);
                    //判断
                    if (cart) {
                        cart.num += this.num;
                    } else {
                        cart = {
                            skuId: this.sku.id,
                            image: this.images[0],
                            title: this.sku.title,
                            ownSpec: this.sku.ownSpec,
                            price: this.sku.price,
                            num: this.num
                        };
                        carts.push(cart);
                    }
                    ly.store.set("LY_CART", carts);
                    //页面跳转
                    window.location = "http://www.leyou.com/cart.html";
                })
            },
            incr() {
                this.num++;
            },
            decr() {
                if (this.num > 1) {
                    this.num--;
                }
            }
        },
        components: {
            lyTop: () => import('/js/pages/top.js')
        }
    });
</script>

<script src="/js/plugins/jquery/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#service").hover(function () {
            $(".service").show();
        }, function () {
            $(".service").hide();
        });
        $("#shopcar").hover(function () {
            $("#shopcarlist").show();
        }, function () {
            $("#shopcarlist").hide();
        });

    })
</script>
<script src="/js/model/cartModel.js" type="text/javascript"></script>
<script src="/js/plugins/jquery.easing/jquery.easing.min.js" type="text/javascript"></script>
<script src="/js/plugins/sui/sui.min.js" type="text/javascript"></script>
<script src="/js/plugins/jquery.jqzoom/jquery.jqzoom.js" type="text/javascript"></script>
<script src="/js/plugins/jquery.jqzoom/zoom.js" type="text/javascript"></script>
<script src="index/index.js" type="text/javascript"></script>
<script th:inline="javascript"></script>

</body>

</html>